package com.google.demo.Util;

import android.content.Context;
import android.content.SharedPreferences;

public class Prefs {
	SharedPreferences prefs;
	Context context;
	public static final String SHAREDPREFERENCES_NAME="mobion_point_pref";
	
	public static final String KEY_SEARCH_GOOGLEMAP="SEARCH_KEYWORD_GOOGLEMAP";
	public static final String KEY_LAT_GPS="LAT_GPS";
	public static final String KEY_LON_GPS="LON_GPS";
	public static final String KEY_ADDRESS_GPS="ADDRESS_GPS";
	
	public Prefs(Context ctx) {
		// TODO Auto-generated constructor stub
		this.context=ctx;
		prefs=ctx.getSharedPreferences(SHAREDPREFERENCES_NAME, Context.MODE_PRIVATE);
	}
	public void putBooleanValue(boolean value,String KEY){
		
		prefs.edit().putBoolean(KEY, value).commit();
	}
	public boolean getBooleanValue(boolean defvalue,String KEY){
		
		return prefs.getBoolean(KEY, defvalue);
	}
	
	public void putStringValue(String value,String KEY){
		
		prefs.edit().putString(KEY, value).commit();
	}
	public String getStringValue(String defvalue,String KEY){
		
		return prefs.getString(KEY, defvalue);
	}
	
	public void putIntValue(int value,String KEY){
		
		prefs.edit().putInt(KEY, value).commit();
	}
	public int getIntValue(int defvalue,String KEY){
		
		return prefs.getInt(KEY, defvalue);
	}
	
	
	public void putLongValue(long value,String KEY){
		
		prefs.edit().putLong(KEY, value).commit();
	}
	public long getLongValue(long defvalue,String KEY){
		
		return prefs.getLong(KEY, defvalue);
	}
	
	
	public void putFloatValue(float value,String KEY){
		
		prefs.edit().putFloat(KEY, value).commit();
	}
	public float getFloatValue(float defvalue,String KEY){
		
		return prefs.getFloat(KEY, defvalue);
	}
	
	
	public void removeValue(String KEY){
		
		prefs.edit().remove(KEY).commit();
	}
}
